import { useEffect, useState } from 'react';
import { Message, Input, Form, Box, Button, Card, DatePicker, Radio, Upload, Table, Rating } from '@alifd/next';
import type { UploadProps } from '@alifd/next/types/upload';
import { Moment } from 'moment';
import styles from './index.module.css';
import EditableCell from './EditableCell';
import { RadioGroup } from '@alifd/next/types/radio/radio-group';
import ChooseFeel from './ChooseFeel';
import ChooseTimeLine from './ChooseTimeLine';
import { TextAreaWithErrorTip } from '@/components/TextAreaWithErrorTip';
import YiwaiForm from './YiwaiForm';

const FormItem = Form.Item;

export const ResultTable = (props: {
    dataSource: any
    extraInfo: any
    onChange: any
}): JSX.Element => {
    return (
        <Card free>
            <Card.Content>
                <Table
                    key={"id"}
                    dataSource={props.dataSource}>
                    <Table.Column style={{
                        width: '100px'
                    }} title={'时间'} dataIndex="time" cell={(value) => {
                        return <div>{`${value[0]}-${value[1]}`}</div>
                    }} />
                    <Table.Column style={{
                        width: '300px'
                    }} title={'做什么'} dataIndex="title" />

                    <Table.Column style={{
                        width: '500px'
                    }} title={<div>
                        列出你具体做什么，珍惜那个物品
                        {/* 满意的标准是什么，怎么停止对比<br />要明白合适就是最好的 */}
                    </div>} dataIndex="id" cell={(id) => {
                        return <TextAreaWithErrorTip placeholder={'珍惜什么'} defaultValue={props.extraInfo[id] ? props.extraInfo[id].good : ''} onChange={(value) => {
                            let extraInfo = props.extraInfo;
                            props.onChange && props.onChange({
                                ...props.extraInfo,
                                [id]: {
                                    ...extraInfo[id],
                                    good: value
                                }
                            });
                        }}></TextAreaWithErrorTip>
                    }} />
                    <Table.Column style={{
                    }} title={<div>
                        列出你不能做的事情，已经放弃的东西
                    </div>} dataIndex="id" cell={(id) => {
                        // return <YiwaiForm defaultValue={props.extraInfo[id] ? props.extraInfo[id].bad : {}} onChange={(value) => {
                        //     let extraInfo = props.extraInfo;
                        //     props.onChange && props.onChange({
                        //         ...props.extraInfo,
                        //         [id]: {
                        //             ...extraInfo[id],
                        //             bad: value
                        //         }
                        //     });
                        // }}></YiwaiForm>
                        return <TextAreaWithErrorTip placeholder={'意外有那些'} defaultValue={props.extraInfo[id] ? props.extraInfo[id].bad : ''} onChange={(value) => {
                            let extraInfo = props.extraInfo;
                            props.onChange && props.onChange({
                                ...props.extraInfo,
                                [id]: {
                                    ...extraInfo[id],
                                    bad: value
                                }
                            });
                        }}></TextAreaWithErrorTip>
                    }} />
                </Table>
            </Card.Content>
        </Card>
    );
};

export default ResultTable;
